<?php 
/**
* Test adding existing and uploaded file.
*/
class DomArSlugTestCase extends DomArTestUnitTestCase {
	
	public function testSlug() {
		
		DomArTestClass_DomArSlug::getTable()->update();
		
		$a = new DomArTestClass_DomArSlug();
		$a->name = 'haha';
		$this->assertEqual( $a->slug, 'haha');
		$a->save();
		
		$b = new DomArTestClass_DomArSlug();
		$b->name = 'haha';
		$this->assertEqual( $b->slug, 'haha-1');
		$b->save();

		$c = new DomArTestClass_DomArSlug();
		$c->name = 'haha';
		$this->assertEqual( $c->slug, 'haha-2');
		$c->save();
		
		$a = new DomArTestClass_DomArSlug();
		$a->name = 'Hello world, i\'am world!';
		$this->assertEqual( $a->slug, 'hello-world-i-am-world');
		$a->save();
		$a->name = 'Ooooppssss';
		$this->assertEqual( $a->slug, 'ooooppssss');
		$a->save();
		
		DomAr::flushStoredObjects();
		
		$a = DomArTestClass_DomArSlug::load( $a->id );
		$this->assertEqual( $a->slug, 'ooooppssss');
		
	}
	

	
}
?>